package com.huanuo.internetofthings.service.jasperSimStatistics.facade;

import org.springframework.stereotype.Service;
import org.unicorn.framework.base.base.AbstractService;
import org.unicorn.framework.core.ResponseDto;
import org.unicorn.framework.core.exception.PendingException;
import org.unicorn.framework.core.handler.HandlerAdapter;

import com.huanuo.internetofthings.dto.statistics.JasperStatisticsReqDto;
import com.huanuo.internetofthings.enums.JasperSimStatisticsType;

@Service
public class JasperSimStatisticsFacadeService extends AbstractService {

	/**
	 *  统计用户所在组  设备sim卡的使用情況
	 * 
	 * @param userIdentity
	 * @return
	 * @throws PendingException
	 */
	public ResponseDto<?> statisticsByGroupNo(String userIdentity) throws PendingException {
		JasperStatisticsReqDto jasperStatisticsReqDto=new JasperStatisticsReqDto();
		jasperStatisticsReqDto.setUserIdentity(userIdentity);
		jasperStatisticsReqDto.setJasperSimStatisticsType(JasperSimStatisticsType.JasperSimGroupNo);
		return  HandlerAdapter.getHandler(jasperStatisticsReqDto).execute(jasperStatisticsReqDto);
	
	}
	/**
	 *  统计设备组Sim卡每月额外总费用汇总情况
	 * 
	 * @param userIdentity
	 * @return
	 * @throws PendingException
	 */
	public ResponseDto<?> statisticsExtraTotalCost(String userIdentity) throws PendingException {
		JasperStatisticsReqDto jasperStatisticsReqDto=new JasperStatisticsReqDto();
		jasperStatisticsReqDto.setUserIdentity(userIdentity);
		jasperStatisticsReqDto.setJasperSimStatisticsType(JasperSimStatisticsType.JasperSim_Extra_Total_Cost_Month_Distribution);
		return  HandlerAdapter.getHandler(jasperStatisticsReqDto).execute(jasperStatisticsReqDto);
	
	}
	/**
	 *  统计设备组Sim卡每月流量使用率汇总情况
	 * 
	 * @param userIdentity
	 * @return
	 * @throws PendingException
	 */
	public ResponseDto<?> statisticsFlowRate(String userIdentity) throws PendingException {
		JasperStatisticsReqDto jasperStatisticsReqDto=new JasperStatisticsReqDto();
		jasperStatisticsReqDto.setUserIdentity(userIdentity);
		jasperStatisticsReqDto.setJasperSimStatisticsType(JasperSimStatisticsType.JasperSim_Total_Flow_Rate_Month_Distribution);
		return  HandlerAdapter.getHandler(jasperStatisticsReqDto).execute(jasperStatisticsReqDto);
	
	}
	
	/**
	 *   统计设备组Sim卡每月流量汇总情况
	 * 
	 * @param userIdentity
	 * @return
	 * @throws PendingException
	 */
	public ResponseDto<?> statisticsFlowTotalCost(String userIdentity) throws PendingException {
		JasperStatisticsReqDto jasperStatisticsReqDto=new JasperStatisticsReqDto();
		jasperStatisticsReqDto.setUserIdentity(userIdentity);
		jasperStatisticsReqDto.setJasperSimStatisticsType(JasperSimStatisticsType.JasperSim_Total_Flow_Cost_Month_Distribution);
		return  HandlerAdapter.getHandler(jasperStatisticsReqDto).execute(jasperStatisticsReqDto);
	
	}
	
	
	/**
	 *   统计设备组Sim卡每月总费用汇总情况
	 * 
	 * @param userIdentity
	 * @return
	 * @throws PendingException
	 */
	public ResponseDto<?> statisticsTotalCost(String userIdentity) throws PendingException {
		JasperStatisticsReqDto jasperStatisticsReqDto=new JasperStatisticsReqDto();
		jasperStatisticsReqDto.setUserIdentity(userIdentity);
		jasperStatisticsReqDto.setJasperSimStatisticsType(JasperSimStatisticsType.JasperSim_Total_Cost_Month_Distribution);
		return  HandlerAdapter.getHandler(jasperStatisticsReqDto).execute(jasperStatisticsReqDto);
	
	}

	/**
	 *   统计设备组Sim卡每月总套餐费用汇总情况
	 * 
	 * @param userIdentity
	 * @return
	 * @throws PendingException
	 */
	public ResponseDto<?> statisticsTotalPackageCost(String userIdentity) throws PendingException {
		JasperStatisticsReqDto jasperStatisticsReqDto=new JasperStatisticsReqDto();
		jasperStatisticsReqDto.setUserIdentity(userIdentity);
		jasperStatisticsReqDto.setJasperSimStatisticsType(JasperSimStatisticsType.JasperSim_Package_Total_Cost_Month_Distribution);
		return  HandlerAdapter.getHandler(jasperStatisticsReqDto).execute(jasperStatisticsReqDto);
	
	}
	
	/**
	 *   统计设备组Sim卡每月流量共享池总使用情况
	 * 
	 * @param userIdentity
	 * @return
	 * @throws PendingException
	 */
	public ResponseDto<?> statisticsFlowShareRate(String userIdentity) throws PendingException {
		JasperStatisticsReqDto jasperStatisticsReqDto=new JasperStatisticsReqDto();
		jasperStatisticsReqDto.setUserIdentity(userIdentity);
		jasperStatisticsReqDto.setJasperSimStatisticsType(JasperSimStatisticsType.JasperSim_Total_Flow_Share_Rate_Month_Distribution);
		return  HandlerAdapter.getHandler(jasperStatisticsReqDto).execute(jasperStatisticsReqDto);
	
	}
	
}